package com.hzw.saas.api.hpc.query;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hzw.saas.api.hpc.enums.HpcContractType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 登记合同参数
 * @Description
 * @Date 2021/7/16 10:54 上午
 * @Created by sonam
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel("登记/修改合同参数")
public class ContractRegistrationQuery {

    @ApiModelProperty(value = "合同ID,为空则是登记参数，否则为更新参数")
    private String pid;

    @ApiModelProperty(value = "用户ID", required = true)
    @NotBlank(message = "用户ID不能为空")
    private String userId;

    @NotNull(message = "合同名称不能为空")
    @ApiModelProperty(value = "合同名称", required = true)
    private String contractName;

    @NotNull(message = "合同编号不能为空")
    @ApiModelProperty(value = "合同编号", required = true)
    private String contractNo;

    @NotNull(message = "合同金额不能为空")
    @Min(value = 1, message = "合同金额必须大于等于1")
    @ApiModelProperty(value = "合同金额", required = true)
    private Double contractAmount;

    @NotNull(message = "购买的核时不能为空")
    @Min(value = 1, message = "购买的核时必须大于等于1")
    @ApiModelProperty(value = "购买的核时", required = true)
    private Double coreTime;

    @ApiModelProperty(value = "无限算力，1｜无限，0｜有限")
    private Integer isInfinite = 0;

    @JsonFormat(pattern = "yyyy-MM-dd")
    @Future(message = "设置的日期必须大于当前时间")
    @NotNull(message = "合同到期日期不能为空")
    @ApiModelProperty(value = "合同到期日期", required = true)
    private Date expireTime;

    @NotNull(message = "合同登记日期不能为空，默认为当天")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @ApiModelProperty(value = "合同到期日期")
    private Date busTime;

    @ApiModelProperty(value = "合同类型")
    private HpcContractType hpcContractType;

    @ApiModelProperty(value = "合同供应商类型")
    private String providerCode;

}
